<template>
  <div @click="selectSlideUp2">
    <div class="yx-tabBar clearfix">
      <router-link to="item" class="fl yx-tab yx-freeze">
        物料分类
      </router-link>
      <router-link to="supplier" v-if="role_id!=4&&role_id!=5" class="fl yx-tab yx-freeze">
        供应商分类
      </router-link>
      <router-link to="relative" v-if="role_id!=4&&role_id!=5" class="fl yx-tab yx-freeze yx-active">
        关联分析
      </router-link>
    </div>

    <!--关联分析-->
    <div class="yx-condition clearfix">
      <div class="yx-form-item clearfix">
        <div class="yx-form-inline">
          <label class="yx-form-label">库存大类</label>
          <div class="yx-form-ul">
            <div class="delete" v-show="query_get_item_big_class_input_delete"
                 @click="inputClear('query_get_item_big_class_input','yxBigClass','yxBigClassID')">X
            </div>
            <input type="text" v-model="query_get_item_big_class_input"
                   @click.stop="selectClick('query_get_item_big_class')">
            <transition name="fade">
              <div class="yx-form-inner-list" v-show="query_get_item_big_class">
                <li v-for="item in query_get_item_big_classData"
                    @click="choose_get_item_big_classFun(item.name,item.value)">
                  <nobr>{{item.value}} {{item.name}}</nobr>
                </li>
                <li v-show="query_get_item_big_classData.length==0" @click="choose_get_item_big_classFun('','')">空</li>
              </div>
            </transition>
          </div>
        </div>
        <div class="yx-form-inline" :class="{'yx-cur': disabledInput}">
          <label class="yx-form-label">库存小类</label>
          <div class="yx-form-ul">
            <div class="delete" v-show="query_get_item_small_class_input_delete"
                 @click="inputClear('query_get_item_small_class_input','yxSmallClass','yxSmalligClassID')">X
            </div>
            <input type="text" v-model="query_get_item_small_class_input"
                   @click.stop="selectClick('query_get_item_small_class')" v-bind:disabled="disabledInput">
            <transition name="fade">
              <div class="yx-form-inner-list" v-show="query_get_item_small_class">
                <li v-for="item in query_get_item_small_classData"
                    @click="choose_get_item_small_classFun(item.name,item.value)">
                  <nobr>{{item.value}} {{item.name}}</nobr>
                </li>
                <li v-show="query_get_item_small_classData.length==0" @click="choose_get_item_small_classFun('','')">
                  空
                </li>
              </div>
            </transition>
          </div>
        </div>
        <div class="yx-form-inline">
          <label class="yx-form-label">物料编号</label>
          <div class="yx-form-ul">
            <div class="delete" v-show="query_get_item_input_delete" @click="inputClear('query_get_item_input','yxItemClass','yxItemClassID')">X</div>
            <input type="text" v-model="query_get_item_input"
                   @click.stop="selectClick('query_get_item')">
            <transition name="fade">
              <div class="yx-form-inner-list" v-show="query_get_item">
                <li v-for="item in query_get_itemData" @click="choose_get_itemFun(item.name,item.value)">
                  <nobr>{{item.name}}</nobr>
                </li>
                <li v-show="query_get_itemData.length==0" @click="choose_get_itemFun('','')">
                  空
                </li>
              </div>
            </transition>
          </div>
        </div>
        <div class="yx-form-inline">
          <label class="yx-form-label">计划类别</label>
          <div class="yx-form-ul">
            <div class="delete" v-show="query_get_plan_class_input_delete" @click="inputClear('query_get_plan_class_input','yxPlanClass','yxPlanClassID')">
              X
            </div>
            <input type="text" v-model="query_get_plan_class_input"
                   @click.stop="selectClick('query_get_plan_class')">
            <transition name="fade">
              <div class="yx-form-inner-list" v-show="query_get_plan_class">
                <li v-for="item in query_get_plan_classData" @click="choose_get_plan_classFun(item.name,item.value)">
                  <nobr>{{item.name}}</nobr>
                </li>
                <li v-show="query_get_plan_classData.length==0" @click="choose_get_plan_classFun('','')">
                  空
                </li>
              </div>
            </transition>
          </div>
        </div>
        <div class="yx-form-inline">
          <label class="yx-form-label">智能分类</label>
          <div class="yx-form-ul">
            <div class="delete" v-show="query_get_item_category_input_delete"
                 @click="inputClear('query_get_item_category_input','yxCategoryClass','yxCategoryClassID')">X
            </div>
            <input type="text" v-model="query_get_item_category_input"
                   @click.stop="selectClick('query_get_item_category')" readonly>
            <transition name="fade">
              <div class="yx-form-inner-list" v-show="query_get_item_category">
                <li v-for="item in query_get_item_categoryData"
                    @click="choose_query_get_item_categoryFun(item.name,item.value)">{{item.name}}
                </li>
                <li v-show="query_get_item_categoryData.length==0" @click="query_get_item_categoryFun('')">
                  空
                </li>
              </div>
            </transition>
          </div>
        </div>
        <div class="yx-form-inline">
          <label class="yx-form-label">采购员</label>
          <div class="yx-form-ul">
            <div class="delete" v-show="query_get_buyer_input_delete" @click="inputClear('query_get_buyer_input','yxBuyerClass','yxBuyerClassID')">X</div>
            <input type="text" v-model="query_get_buyer_input"
                   @click.stop="selectClick('query_get_buyer')">
            <transition name="fade">
              <div class="yx-form-inner-list" v-show="query_get_buyer">
                <li v-for="item in query_get_buyerData" @click="choose_query_get_buyerFun(item.name,item.value)">
                  <nobr>{{item.value}} {{item.name}}</nobr>
                </li>
                <li v-show="query_get_buyerData.length==0" @click="choose_query_get_buyerFun('','')">
                  空
                </li>
              </div>
            </transition>
          </div>
        </div>
        <div class="yx-form-inline">
          <label class="yx-form-label">Sourcing</label>
          <div class="yx-form-ul">
            <div class="delete" v-show="query_get_sourcing_input_delete" @click="inputClear('query_get_sourcing_input','yxSourcingClass','yxSourcingClassID')">X
            </div>
            <input type="text" v-model="query_get_sourcing_input"
                   @click.stop="selectClick('query_get_sourcing')">
            <transition name="fade">
              <div class="yx-form-inner-list" v-show="query_get_sourcing">
                <li v-for="item in query_get_sourcingData" @click="choose_query_get_sourcingFun(item.name,item.value)">
                  <nobr>{{item.value}} {{item.name}}</nobr>
                </li>
                <li v-show="query_get_sourcingData.length==0" @click="choose_query_get_sourcingFun('','')">
                  空
                </li>
              </div>
            </transition>
          </div>
        </div>
        <div class="yx-form-inline">
          <label class="yx-form-label">计划员</label>
          <div class="yx-form-ul">
            <div class="delete" v-show="query_get_planner_input_delete" @click="inputClear('query_get_planner_input','yxPlannerClass','yxPlannerClassID')">X</div>
            <input type="text" v-model="query_get_planner_input"
                   @click.stop="selectClick('query_get_planner')">
            <transition name="fade">
              <div class="yx-form-inner-list" v-show="query_get_planner">
                <li v-for="item in query_get_plannerData" @click="choose_query_get_plannerFun(item.name,item.value)">
                  <nobr>{{item.value}} {{item.name}}</nobr>
                </li>
                <li v-show="query_get_plannerData.length==0" @click="choose_query_get_plannerFun('','')">
                  空
                </li>
              </div>
            </transition>
          </div>
        </div>
      </div>
      <div class="clearfix">
        <div class="fr yx-marginRight30">
          <button class="yx-btn-yellow" @click="queryFun()">查询</button>
          <button class="yx-btn-grey" @click="clearCondition()">重置</button>
        </div>
      </div>
    </div>
    <div class="yx-content">
      <div class="yx-label">物料搜索结果</div>

      <table class="yx-table yx-marginTop40 yx-widthP100"
             v-show="!relevanceSilentQueryIsError&&!relevanceSilentQueryIsLoading">
        <colgroup>
          <col width="12%">
          <col width="28%">
          <col width="7%">
          <col width="7%">
          <col width="8%">
          <col width="8%">
          <col width="9%">
          <col width="12%">
          <col width="9%">
        </colgroup>
        <tr>
          <th>物料编号</th>
          <th>描述</th>
          <th>库存大类</th>
          <th>库存小类</th>
          <th>计划类别</th>
          <th>采购员</th>
          <th>Sourcing</th>
          <th>计划员</th>
          <th>供应商智能分类</th>
        </tr>
        <tr class="cursor" v-for="(item,index) in relevance_silent_queryData.items" v-bind:class="{'trClickActive':tableTrClick==(index+1)}" @click="ff(index+1,item.ITEM,item.SEGMENT1);">
          <td class="textClick">{{item.SEGMENT1}}</td>
          <td>{{item.DESCRIPTION}}</td>
          <td>{{item.ITEM_BIG_CLASS}}</td>
          <td>{{item.ITEM_SMALL_CLASS}}</td>
          <td>{{item.STRATEGY}}</td>
          <td>{{item.BUYER_NAME}}</td>
          <td>{{item.UN_NAME}}</td>
          <td>{{item.PLANNER_CODE}} {{item.PLANNER_NAME}}</td>
          <td>{{item.CLASS}}</td>
        </tr>
      </table>
      <div class="table-tr" v-show="relevance_silent_queryData.pages>1&&!relevanceSilentQueryIsError&&!relevanceSilentQueryIsLoading">
        <div class="pageturn">
          共
          <em>{{relevance_silent_queryData.total | numberThousand}}</em>
          条，第
          <em>{{relevance_silent_queryData.page | numberThousand}}</em>
          /
          <em>{{relevance_silent_queryData.pages | numberThousand}}</em>
          页，跳转到第
          <input type="text" class="pageturn-ipt" v-model="relevance_silent_queryPage" value=""/>
          页
          <span class="page-turn" @click="relevance_silent_queryFun(relevance_silent_queryPage>=0&&relevance_silent_queryPage<=relevance_silent_queryData.pages?relevance_silent_queryPage:relevance_silent_queryData.page)">跳转</span>
          <span class="page-first" @click="relevance_silent_queryFun(1)">首页</span>
          <span class="page-up"
                @click="relevance_silent_queryData.page>1?relevance_silent_queryFun(relevance_silent_queryData.page-1):1">上一页</span>
          <span class="page-down"
                @click="relevance_silent_queryData.page<relevance_silent_queryData.pages?relevance_silent_queryFun(relevance_silent_queryData.page+1):''">下一页</span>
          <span class="page-last" @click="relevance_silent_queryFun(relevance_silent_queryData.pages)">末页</span>
        </div>
      </div>
      <div class="loadingBox">
        <div class="loadding80" v-show="relevanceSilentQueryIsLoading"></div>
        <div class="frame-noData" v-show="relevanceSilentQueryIsError">暂无数据...</div>
      </div>

      <p class="yx-marginTop40 yx-fontSize22 yx-marginBottom24 certainClassName">
        物料：<span>{{certainItemName}}</span></p>
      <div class="figureChangeTab">
        <ul class="clearfix">
          <li class="fl" :class="{'figureChangeTabActive': configShow==1}" @click="configShow=1">供货稳定性分析</li>
          <li class="fl" :class="{'figureChangeTabActive': configShow==2}" @click="configShow=2">价格分析</li>
          <li class="fl" :class="{'figureChangeTabActive': configShow==3}" @click="configShow=3">采购数量分析</li>
          <li class="fl" :class="{'figureChangeTabActive': configShow==4}"
              @click="configShow=4">采购供应商
          </li>
        </ul>
      </div>
      <div v-show="configShow==1">
        <div class="yx-label yx-marginTop40 ">供货稳定性分析</div>
        <div class="yx-cover" id="stableBar"
             v-show="!relevanceStableAnalysisIsLoading&&!relevanceStableAnalysisIsError"></div>
        <div class="loadingBox">
          <div class="loadding80" v-show="relevanceStableAnalysisIsLoading"></div>
          <div class="frame-noData" v-show="relevanceStableAnalysisIsError">暂无数据...</div>
        </div>
      </div>
      <div v-show="configShow==2">
        <div class="yx-label yx-marginTop40 ">价格分析</div>
        <div class="yx-cover" id="priceBar"
             v-show="!relevancePriceAnalysisIsLoading&&!relevancePriceAnalysisIsError"></div>
        <div class="loadingBox">
          <div class="loadding80" v-if="relevancePriceAnalysisIsLoading"></div>
          <div class="frame-noData" v-if="relevancePriceAnalysisIsError">暂无数据...</div>
        </div>
      </div>
      <div v-show="configShow==3">
        <div class="yx-label yx-marginTop40 ">采购分析</div>
        <div class="yx-cover" id="purchaseBar"
             v-show="!relevancePurchaseAnalysisIsLoading&&!relevancePurchaseAnalysisIsError"></div>
        <div class="loadingBox">
          <div class="loadding80" v-show="relevancePurchaseAnalysisIsLoading"></div>
          <div class="frame-noData" v-show="relevancePurchaseAnalysisIsError">暂无数据...</div>
        </div>
      </div>
      <div v-show="configShow==4">
        <div class="yx-label yx-marginTop40 ">采购供应商</div>
        <div class="yx-marginTop40 yx-select-change clearfix">
          <div class="fl yx-selectTabName">季度</div>
          <div class="clearfix yx-select-box">
            <input type="text" v-model="selectSeasonName" readonly @click.stop="selectSeason=!selectSeason">
            <transition name="fade">
              <ul v-show="selectSeason">
                <li v-for="item in relevance_purchase_quarterData"
                    @click="choose_relevance_purchase_quarterFunchoose(item.key,item.name)">{{item.name}}
                </li>
              </ul>
            </transition>
          </div>
        </div>

        <div class=" yx-marginTop40 yx-table-auto"
             style="overflow: auto;"
             v-show="!relevancePurchaseVendorIsLoading&&!relevancePurchaseVendorIsError">
          <table class="yx-table" style="width: 25rem;border-left:none">
            <colgroup>
              <col width="12%">
              <col width="4%">
              <col width="2%">
              <col width="4%">
              <col width="4%">
              <col width="5%">
              <col width="5%">
              <col width="4%">
              <col width="4%">
              <col width="6%">
              <col width="6%">
              <col width="7%">
              <col width="7%">
              <col width="5%">
              <col width="4%">
              <col width="3%">
              <col width="6%">
              <col width="8%">
              <col width="4%">
            </colgroup>
            <tr>
              <th>供应商</th>
              <th>智能分类</th>
              <th>分配</th>
              <th>批准状态</th>
              <th>认定状态</th>
              <th>未认定限额</th>
              <th>来源规则比例</th>
              <th>实际比例</th>
              <th>是否VMI</th>
              <th>最小采购提前期</th>
              <th>最大采购提前期</th>
              <th>最小提货周期</th>
              <th>最大提货周期</th>
              <th>紧急订单次数</th>
              <th>晚交次数</th>
              <th>价格</th>
              <th>订单提前期波动</th>
              <th>提货提前周期波动</th>
              <th>价格波动</th>
            </tr>
            <tr v-for="item in relevance_purchase_vendorData.items">
              <td @click="relevance_vendor_detailFun(item.VENDOR_SITE_ID,item.VENDOR_CODE)" class="textClick">
                {{item.VENDOR_CODE}}
              </td>
              <td>{{item.CATEGORY}}</td>
              <td>-</td>
              <td>{{item.DISABLE_FLAG==''||item.DISABLE_FLAG==null?'-':item.DISABLE_FLAG}}</td>
              <td>{{item.ASL_STATUS_ID==''||item.ASL_STATUS_ID==null?'-':item.ASL_STATUS_ID}}</td>
              <td>{{item.ATTRIBUTE1|numberThousand}}</td>
              <td>{{item.ALLOCATION_PERCENT|numberThousand}}</td>
              <td>{{item.PERSENT | numberPercent}}</td>
              <td>{{item.ENABLE_VMI_FLAG==''||item.ENABLE_VMI_FLAG==null?'-':item.ENABLE_VMI_FLAG}}</td>
              <td>{{item.MINP|numberThousand}}</td>
              <td>{{item.MAXP|numberThousand}}</td>
              <td>{{item.MINS|numberThousand}}</td>
              <td>{{item.MAXS|numberThousand}}</td>
              <td>{{item.F1|numberThousand}}</td>
              <td>{{item.F2|numberThousand}}</td>
              <td>{{item.PRICE|numberThousand}}</td>
              <td>{{item.LT | numberThousand}}</td>
              <td>{{item.RECV_LT | numberThousand}}</td>
              <td>{{item.AVG_PRICE | numberThousand}}</td>
            </tr>
          </table>
        </div>
        <div class="table-tr"
             v-show="relevance_purchase_vendorData.pages>1&&!relevancePurchaseVendorIsLoading&&!relevancePurchaseVendorIsError">
          <div class="pageturn">
            共
            <em>{{relevance_purchase_vendorData.total | numberThousand}}</em>
            条，第
            <em>{{relevance_purchase_vendorData.page | numberThousand}}</em>
            /
            <em>{{relevance_purchase_vendorData.pages | numberThousand}}</em>
            页，跳转到第
            <input type="text" class="pageturn-ipt" v-model="relevance_purchase_vendorDataPage" value=""/>
            页
            <span class="page-turn" @click="relevance_purchase_vendorFun(relevance_purchase_vendorDataPage)">跳转</span>
            <span class="page-first" @click="relevance_purchase_vendorFun(1)">首页</span>
            <span class="page-up"
                  @click="relevance_purchase_vendorData.page>1?relevance_purchase_vendorFun(relevance_purchase_vendorData.page-1):1">上一页</span>
            <span class="page-down"
                  @click="relevance_purchase_vendorData.page<relevance_purchase_vendorData.pages?relevance_purchase_vendorFun(relevance_purchase_vendorData.page+1):''">下一页</span>
            <span class="page-last" @click="relevance_purchase_vendorFun(relevance_purchase_vendorData.pages)">末页</span>
          </div>
        </div>
        <div class="yx-marginTop40 loadingBox">
          <div class="loadding80" v-show="relevancePurchaseVendorIsLoading"></div>
          <div class="frame-noData" v-show="relevancePurchaseVendorIsError">暂无数据...</div>
        </div>

        <p class="yx-marginTop40 yx-fontSize22 yx-marginBottom24 certainClassName">
          供应商：<span>{{relevance_vendor_current}}</span>
        </p>
        <table class="yx-table yx-widthP100"
               v-show="!relevanceVendorDetailIsLoading&&!relevanceVendorDetailIsError">
          <tr>
            <th></th>
            <th colspan="2" v-for="item in relevance_vendor_detailData">{{item.TRANSACTION_DATE | date10Filter}}</th>
          </tr>
          <tr>
            <th></th>
            <th>协议</th>
            <th>实际</th>
            <th>协议</th>
            <th>实际</th>
            <th>协议</th>
            <th>实际</th>
            <th>协议</th>
            <th>实际</th>
            <th>协议</th>
            <th>实际</th>
            <th>协议</th>
            <th>实际</th>
            <th>协议</th>
            <th>实际</th>
            <th>协议</th>
            <th>实际</th>
            <th>协议</th>
            <th>实际</th>
            <th>协议</th>
            <th>实际</th>
            <th>协议</th>
            <th>实际</th>
            <th>协议</th>
            <th>实际</th>
          </tr>
          <tr>
            <td>采购提前期</td>
            <td>{{relevance_vendor_detailData0.EXPECT_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData0.REAL_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData1.EXPECT_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData1.REAL_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData2.EXPECT_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData2.REAL_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData3.EXPECT_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData3.REAL_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData4.EXPECT_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData4.REAL_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData5.EXPECT_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData5.REAL_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData6.EXPECT_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData6.REAL_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData7.EXPECT_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData7.REAL_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData8.EXPECT_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData8.REAL_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData9.EXPECT_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData9.REAL_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData10.EXPECT_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData10.REAL_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData11.EXPECT_LT|numberThousand}}</td>
            <td>{{relevance_vendor_detailData11.REAL_LT|numberThousand}}</td>
          </tr>
        </table>
        <div class="yx-marginTop40 loadingBox">
          <div class="loadding80" v-show="relevanceVendorDetailIsLoading"></div>
          <div class="frame-noData" v-show="relevanceVendorDetailIsError">暂无数据...</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  import common from '../common/js/common'

  var yxBigClass='';
  var echarts = require('echarts');
  export default {
    data() {
      return {
        tableTrClick:1,
      	role_id:0,	//存储权限代号
        selectSeasonName: '',
        selectSeason: false,
        disabledInput: true,
        colorList: [
          '#1fbb61', '#ffbe4c', '#fc7470', '#56b5f1', '#837df5', '#1acfc9', '#d275f4'
        ],
        optionPie: {
          tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)",
            confine: true
          },
          color: ['#ffbe4c', '#fc7470', '#56b5f1', '#51d489'],
          series: {
            name: '供应商分类占比',
            type: 'pie',
            radius: '90%',
            center: ['50%', '50%'],
            label: {
              normal: {
                show: false
              }
            },
            data: [
              {value: [], name: 'I类'},
              {value: [], name: 'II类'},
              {value: [], name: 'III类'},
            ],
            itemStyle: {
              normal: {
                borderWidth: 1,
                borderColor: 'white'
              },
              emphasis: {
                shadowBlur: 5,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        },
        optionBarLine: {
          tooltip: {
            trigger: 'axis',
            /* formatter: function (params) {
               var paramsItem='';
               for(var i=0;i<params.length;i++){
                 paramsItem=paramsItem+params[i].seriesName + '：' + params[i].data[1].toFixed(2)+'</br>'
               }
               return (params[0].data[0]+'</br>'+paramsItem)
             },*/
          },
          legend: {
            data: []
          },
          grid: {
            show: true,
            top: '50',
            left: '4%',
            right: '4%',
            bottom: '50',
            /*backgroundColor:'#fafafa',*/
            borderWidth: 0
          },
          dataZoom: [{
            show: true,
            height: 20,
            xAxisIndex: [0],
            bottom: 0,
            start: 0,
            end: 100,
            handleIcon: 'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
            handleSize: '110%',
            handleStyle: {
              color: "#d3dee5",

            },
            textStyle: {
              color: "#fff"
            },
            borderColor: "#90979c"
          }, {
            type: 'inside',
            show: true,
            height: 15,
            start: 1,
            end: 35
          }],
          xAxis: {
            type: 'category',
            data: [],
            name: '时间',
          },
          yAxis: [{
            name: '',
            type: 'value',
            splitLine: {
              lineStyle: {
                color: '#eee'
              }
            },
            axisLabel: {
              /*formatter:function(v){
                return $scope.allFun.wan(v);
              }*/
            }
          }],
          series: []
        },
        selectListName: [
          'query_get_item_big_class',
          'query_get_item_small_class',
          'query_get_item',
          'query_get_plan_class',
          'query_get_item_category',
          'query_get_buyer',
          'query_get_sourcing',
          'query_get_planner',
          'query_get_vendor'
        ],
        query_get_item_big_class: false,
        query_get_item_big_class_input:localStorage.getItem('yxBigClassFistTime'),
        query_get_item_big_class_input_id: '',
        query_get_item_big_class_input_delete: false,
        query_get_item_big_classData: [],//下拉框--库存大类

        query_get_item_small_class: false,
        query_get_item_small_class_input: '',
        query_get_item_small_class_input_id: '',
        query_get_item_small_class_input_delete: false,
        query_get_item_small_classData: [],//下拉框--库存小类

        query_get_item: false,
        query_get_item_input: '',
        query_get_item_input_id: '',
        query_get_item_input_delete: false,
        query_get_itemData: [],//下拉框--物料编号

        query_get_plan_class: false,
        query_get_plan_class_input: '',
        query_get_plan_class_input_id: '',
        query_get_plan_class_input_delete: false,
        query_get_plan_classData: [],//下拉框--计划类别

        query_get_item_category: false,
        query_get_item_category_input: '',
        query_get_item_category_input_id: '',
        query_get_item_category_input_delete: false,
        query_get_item_categoryData: [],//下拉框--智能分类

        query_get_buyer: false,
        query_get_buyer_input: '',
        query_get_buyer_input_id: '',
        query_get_buyer_input_delete: false,
        query_get_buyerData: [],//下拉框--采购员

        query_get_sourcing: false,
        query_get_sourcing_input: '',
        query_get_sourcing_input_id: '',
        query_get_sourcing_input_delete: false,
        query_get_sourcingData: [],//下拉框--sourcing

        query_get_planner: false,
        query_get_planner_input: '',
        query_get_planner_input_id: '',
        query_get_planner_input_delete: false,
        query_get_plannerData: [],//下拉框--计划员


        relevance_analysisFirstTime: true,
        isLoading: true,
        isError: false,
        overviewInfoData: {Class_A_item: {}, Class_B_item: {}, Class_C_item: {}},//圆饼图+表数据
        relevance_silent_queryPage: 1,
        relevance_silent_queryData: {},
        relevanceSilentQueryIsLoading: true,
        relevanceSilentQueryIsError: false,
        relevance_stable_analysisData: {},
        relevanceStableAnalysisIsLoading: true,
        relevanceStableAnalysisIsError: false,
        relevance_price_analysisData: {},
        relevancePriceAnalysisIsLoading: true,
        relevancePriceAnalysisIsError: false,
        relevance_purchase_analysisData: {},
        relevancePurchaseAnalysisIsLoading: true,
        relevancePurchaseAnalysisIsError: false,
        configShow: 1,
        certainItemName: '',
        chooseCategoryRadio: 'all',
        relevance_purchase_vendorData: {},
        relevance_vendor_detailData: {},

        relevancePurchaseVendorIsLoading: true,
        relevancePurchaseVendorIsError: false,
        relevanceVendorDetailIsLoading: true,
        relevanceVendorDetailIsError: false,
        relevance_vendor_detailData0: {},
        relevance_vendor_detailData1: {},
        relevance_vendor_detailData2: {},
        relevance_vendor_detailData3: {},
        relevance_vendor_detailData4: {},
        relevance_vendor_detailData5: {},
        relevance_vendor_detailData6: {},
        relevance_vendor_detailData7: {},
        relevance_vendor_detailData8: {},
        relevance_vendor_detailData9: {},
        relevance_vendor_detailData10: {},
        relevance_vendor_detailData11: {},
        relevance_purchase_quarterData: [],
        relevance_vendor_current: '',
        selectSeasonName_id: '',
        relevance_purchase_vendorDataPage: 1,
        relevancePurchaseVendorFirstTime:true,
        relativeFirstTime:true,
      }
    },
    watch: {
      query_get_item_big_class_input: function () {//大类
        if (this.query_get_item_big_class_input == '') {
          this.query_get_item_big_class_input_id = '';
          this.query_get_item_big_class_input_delete = false;
          this.disabledInput = true;
        } else {
          this.query_get_item_big_class_input_delete = true;
          this.disabledInput = false;
        }
        this.query_get_item_big_classFun();
      },
      query_get_item_small_class_input: function () {//小类
        if (this.query_get_item_small_class_input == '') {
          this.query_get_item_small_class_input_id = '';
          this.query_get_item_small_class_input_delete = false;
        } else {
          this.query_get_item_small_class_input_delete = true;
        }
        this.query_get_item_small_classFun();
      },
      query_get_item_input: function () {//物料编号
        if (this.query_get_item_input == '') {
          this.query_get_item_input_id = '';
          this.query_get_item_input_delete = false;
        } else {
          this.query_get_item_input_delete = true;
        }
        this.query_get_itemFun();
      },
      query_get_plan_class_input: function () {//计划类别
        if (this.query_get_plan_class_input == '') {
          this.query_get_plan_class_input_id = '';
          this.query_get_plan_class_input_delete = false;
        } else {
          this.query_get_plan_class_input_delete = true;
        }
      },
      query_get_item_category_input: function () {
        if (this.query_get_item_category_input == '') {
          this.query_get_item_category_input_id = '';
          this.query_get_item_category_input_delete = false;
        } else {
          this.query_get_item_category_input_delete = true;
        }
      },
      query_get_buyer_input: function () {//采购员
        if (this.query_get_buyer_input == '') {
          this.query_get_buyer_input_id = '';
          this.query_get_buyer_input_delete = false;
        } else {
          this.query_get_buyer_input_delete = true;
        }
        this.query_get_buyerFun();
      },
      query_get_sourcing_input: function () {//sourcing
        if (this.query_get_sourcing_input == '') {
          this.query_get_sourcing_input_id = '';
          this.query_get_sourcing_input_delete = false;
        } else {
          this.query_get_sourcing_input_delete = true;
        }
        this.query_get_sourcingFun()
      },
      query_get_planner_input: function () {//计划员
        if (this.query_get_planner_input == '') {
          this.query_get_planner_input_id = '';
          this.query_get_planner_input_delete = false;
        } else {
          this.query_get_planner_input_delete = true;
        }
        this.query_get_plannerFun()
      },
      /* selectSeasonName: function () {
         this.relevance_purchase_vendorFun()
       }*/
    },
    beforeCreate(){
      this.relativeFirstTime=true;
    },
    activated(){
      if(sessionStorage.yxBigClass){
        this.query_get_item_big_class_input=sessionStorage.yxBigClass;
        this.query_get_item_big_class_input_id=sessionStorage.yxBigClassID;
        this.query_get_item_small_classFun();
      }else{
        this.query_get_item_big_class_input='';
        this.query_get_item_big_class_input_id='';
      }
      if(sessionStorage.yxSmallClass){
        this.query_get_item_small_class_input=sessionStorage.yxSmallClass;
        this.query_get_item_small_class_input_id=sessionStorage.yxSmallClassID;
      }else{
        this.query_get_item_small_class_input='';
        this.query_get_item_small_class_input_id='';
      }
      if(sessionStorage.yxItemClass){
        this.query_get_item_input=sessionStorage.yxItemClass;
        this.query_get_item_input_id=sessionStorage.yxItemClassID;
      }else{
        this.query_get_item_input='';
        this.query_get_item_input_id='';
      }
      if(sessionStorage.yxPlanClass){
        this.query_get_plan_class_input=sessionStorage.yxPlanClass;
        this.query_get_plan_class_input_id=sessionStorage.yxPlanClassID;
      }else{
        this.query_get_plan_class_input='';
        this.query_get_plan_class_input_id='';
      }
      if(sessionStorage.yxCategoryClass){
        this.query_get_item_category_input=sessionStorage.yxCategoryClass;
        this.query_get_item_category_input_id=sessionStorage.yxCategoryClassID;
      }else{
        this.query_get_item_category_input='';
        this.query_get_item_category_input_id='';
      }
      if(sessionStorage.yxBuyerClass){
        this.query_get_buyer_input=sessionStorage.yxBuyerClass;
        this.query_get_buyer_input_id=sessionStorage.yxBuyerClassID;
      }else{
        this.query_get_buyer_input='';
        this.query_get_buyer_input_id='';
      }
      if(sessionStorage.yxSourcingClass){
        this.query_get_sourcing_input=sessionStorage.yxSourcingClass;
        this.query_get_sourcing_input_id=sessionStorage.yxSourcingClassID
      }else{
        this.query_get_sourcing_input='';
        this.query_get_sourcing_input_id='';
      }
      if(sessionStorage.yxPlannerClass){
        this.query_get_planner_input=sessionStorage.yxPlannerClass;
        this.query_get_planner_input_id=sessionStorage.yxPlannerClassID;
      }else{
        this.query_get_planner_input='';
        this.query_get_planner_input_id='';
      }
    },
    mounted() {
    	this.getRole_id();//权限操作
       /*this.query_get_item_big_classFun();
       this.query_get_item_small_classFun();*/
      /* this.query_get_itemFun();*/
     /*  this.query_get_plan_classFun();
       this.query_get_item_categoryFun();
       this.query_get_buyerFun();
       this.query_get_sourcingFun();
       this.query_get_plannerFun();*/
      this.queryFun();
      this.relevance_purchase_quarterFun();
    },
    methods: {
    	/*权限控制*/
    	getRole_id:function(){
	    	this.role_id = localStorage.getItem("role_id");
	    },
      initData:function(){
        let _self=this;
        _self.query_get_item_big_class_input=yxBigClass;
      },

      ff:function(index,id,name){
        if(this.tableTrClick!=index){
          this.tableTrClick=index;
          this.relevance_analysisFun(id,name);
        }else{
          this.tableTrClick=!this.tableTrClick;
        }
      },

      setDateList: function (date) {
        for (var i = 0; i < date.length; i++) {
          date[i] = date[i].substr(0, 10);
        }
        return date
      },
      selectClick: function (x) {
        var _self = this;
        var funName = x + 'Fun';
        /*if (x == 'query_get_item_category') {

        } else {*/
          _self[funName]();
        for (var i = 0; i < _self.selectListName.length; i++) {
          var yy = _self.selectListName[i];
          yy == x ? _self[x] = !_self[x] : _self[yy] = false;
        }
      },
      selectSlideUp2: function () {
        var _self = this;
        for (var i = 0; i < _self.selectListName.length; i++) {
          var yx = _self.selectListName[i];
          _self[yx] = false;
        }
        this.selectSeason = false;
      },

      /*置空*/
      clearCondition: function () {
        var _self=this;
        for(var i=0;i<_self.selectListName.length;i++){
          var select_input=_self.selectListName[i]+'_input';
          var select_id=_self.selectListName[i]+'_input_id';
          var select_boss=_self.selectListName[i]+'_input_boss';
          _self[select_input]='';
          _self[select_id]='';
          _self[select_boss]='';
        }
      },
      /*下拉框--库存大类*/
      query_get_item_big_classFun: function () {
        var _self = this;
        var yx_data = {
          "dim": this.query_get_item_big_class_input.indexOf(' ') > -1 ? this.query_get_item_big_class_input.split(' ')[1] : this.query_get_item_big_class_input
        }
        common.getData(-1, common.url_constitute.query_get_item_big_class, "post", yx_data, function (d) {
          if (d.data.code == 1024) {
            _self.query_get_item_big_classData = d.data.result;
          }
        })
      },
      /*下拉框--库存大类--选择*/
      choose_get_item_big_classFun: function (name, num) {
        this.query_get_item_big_class_input = num + ' ' + name;
        this.query_get_item_big_class_input_id = num;
        this.selectSlideUp2();
        this.query_get_item_small_classFun();
        sessionStorage.yxBigClass=this.query_get_item_big_class_input;
        sessionStorage.yxBigClassID=this.query_get_item_big_class_input_id;
      },
      /*下拉框--库存小类*/
      query_get_item_small_classFun: function () {
        var _self = this;
        var yx_data = {
          "big_class": this.query_get_item_big_class_input.indexOf(' ') > -1 ? this.query_get_item_big_class_input.split(' ')[0] : this.query_get_item_big_class_input,
          "dim": this.query_get_item_small_class_input.indexOf(' ') > -1 ? this.query_get_item_small_class_input.split(' ')[1] : this.query_get_item_small_class_input
        }
        common.getData(-1, common.url_constitute.query_get_item_small_class, "post", yx_data, function (d) {
          if (d.data.code == 1024) {
            _self.query_get_item_small_classData = d.data.result;
          }
        })
      },
      /*下拉框--库存小类--选择*/
      choose_get_item_small_classFun: function (name, num) {
        this.query_get_item_small_class_input = num + ' ' + name;
        this.query_get_item_small_class_input_id = num;
        this.selectSlideUp2();
        this.query_get_itemFun();
        sessionStorage.yxSmallClass=this.query_get_item_small_class_input;
        sessionStorage.yxSmallClassID=this.query_get_item_small_class_input_id;
      },
      /*下拉框--物料编号*/
      query_get_itemFun: function () {
        var _self = this;
        var yx_data = {
          "big_class": this.query_get_item_big_class_input.indexOf(' ') > -1 ? this.query_get_item_big_class_input.split(' ')[0] : this.query_get_item_big_class_input,
          "small_class": this.query_get_item_small_class_input.indexOf(' ') > -1 ? this.query_get_item_small_class_input.split(' ')[0] : this.query_get_item_small_class_input,
          "dim": this.query_get_item_input
        }
        common.getData(-1, common.url_constitute.query_get_item, "post", yx_data, function (d) {
          if (d.data.code == 1024) {
            _self.query_get_itemData = d.data.result;
          }
        })
      },
      /*下拉框--物料编号--选择*/
      choose_get_itemFun: function (name, num) {
        this.query_get_item_input = name;
        this.query_get_item_input_id = num;
        this.selectSlideUp2();
        sessionStorage.yxItemClass=this.query_get_item_input;
        sessionStorage.yxItemClassID=this.query_get_item_input_id;
      },
      /*下拉框--计划类别*/
      query_get_plan_classFun: function () {
        var _self = this;
        var yx_data = {};
        common.getData(-1, common.url_constitute.query_get_plan_class, "post", yx_data, function (d) {
          if (d.data.code == 1024) {
            _self.query_get_plan_classData = d.data.result;
          }
        })
      },
      /*下拉框--计划类别--选择*/
      choose_get_plan_classFun: function (name, num) {
        this.query_get_plan_class_input = name;
        this.query_get_plan_class_input_id = num;
        this.selectSlideUp2();
        sessionStorage.yxPlanClass=this.query_get_plan_class_input;
        sessionStorage.yxPlanClassID=this.query_get_plan_class_input_id;
      },
      /*下拉框--智能分类*/
      query_get_item_categoryFun: function () {
        var _self = this;
        var yx_data = {
          "dim": this.query_get_item_category_input == '' ? '' : this.query_get_item_category_input,
        };
        common.getData(-1, common.url_constitute.query_get_item_category, "post", yx_data, function (d) {
          if (d.data.code == 1024) {
            _self.query_get_item_categoryData = d.data.result;
          }
        })
      },
      /*下拉框--智能分类--选择*/
      choose_query_get_item_categoryFun: function (name, num) {
        this.query_get_item_category_input = name;
        this.query_get_item_category_input_id = num;
        this.selectSlideUp2();
        sessionStorage.yxCategoryClass=this.query_get_item_category_input;
        sessionStorage.yxCategoryClassID=this.query_get_item_category_input_id;
      },
      /*下拉框--采购员*/
      query_get_buyerFun: function () {
        var _self = this;
        var yx_data = {
          "dim": this.query_get_buyer_input.indexOf(' ') > -1 ? this.query_get_buyer_input.split(' ')[1] : this.query_get_buyer_input,
        };
        common.getData(-1, common.url_constitute.query_get_buyer, "post", yx_data, function (d) {
          if (d.data.code == 1024) {
            _self.query_get_buyerData = d.data.result;
          }
        })
      },
      /*下拉框--采购员--选择*/
      choose_query_get_buyerFun: function (name, num) {
        this.query_get_buyer_input = num + ' ' + name;
        this.query_get_buyer_input_id = num;
        this.selectSlideUp2();
        sessionStorage.yxBuyerClass=this.query_get_buyer_input;
        sessionStorage.yxBuyerClassID=this.query_get_buyer_input_id;
      },
      /*下拉框--sourcing*/
      query_get_sourcingFun: function () {
        var _self = this;
        var yx_data = {
          "dim": this.query_get_sourcing_input.indexOf(' ') > -1 ? this.query_get_sourcing_input.split(' ')[1] : this.query_get_sourcing_input,
        };
        common.getData(-1, common.url_constitute.query_get_sourcing, 'post', yx_data, function (d) {
          if (d.data.code == 1024) {
            _self.query_get_sourcingData = d.data.result;
          }
        });
      },
      /*下拉框--sourcing--选择*/
      choose_query_get_sourcingFun: function (name, num) {
        this.query_get_sourcing_input = num + ' ' + name;
        this.query_get_sourcing_input_id = num;
        this.selectSlideUp2();
        sessionStorage.yxSourcingClass=this.query_get_sourcing_input;
        sessionStorage.yxSourcingClassID=this.query_get_sourcing_input_id;
      },
      /*下拉框--计划员*/
      query_get_plannerFun: function () {
        var _self = this;
        var yx_data = {
          "dim": this.query_get_planner_input.indexOf(' ') > -1 ? this.query_get_planner_input.split(' ')[1] : this.query_get_planner_input,
        };
        common.getData(-1, common.url_constitute.query_get_planner, 'post', yx_data, function (d) {
          if (d.data.code == 1024) {
            _self.query_get_plannerData = d.data.result;
          }
        })
      },
      /*下拉框--计划员--选择*/
      choose_query_get_plannerFun: function (name, num) {
        this.query_get_planner_input = num + ' ' + name;
        this.query_get_planner_input_id = num;
        this.selectSlideUp2();
        sessionStorage.yxPlannerClass=this.query_get_planner_input;
        sessionStorage.yxPlannerClassID=this.query_get_planner_input_id;
      },
      /*INPUT自带的×*/
      inputClear:function(who,sessionWho,sessionID){
        var _self=this;
        _self[who]='';
        sessionStorage[sessionWho]='';
        sessionStorage[sessionID]='';
        if(who=='query_get_item_big_class_input'){
          _self.query_get_item_small_class_input='';
          _self.query_get_item_small_class_input_id='';
          sessionStorage.yxSmallClass='';
          sessionStorage.yxSmallClassID='';
        }
      },

      /*关联分析--查询*/
      queryFun: function () {
        var _self=this;
        for(var i=0;i<_self.selectListName.length;i++){
          var select_input_id=_self.selectListName[i]+'_input_id';
          var select_boss=_self.selectListName[i]+'_input_boss';
          _self[select_boss]=_self[select_input_id];
        }

        this.certainItemName = '';
        this.relevance_analysisFirstTime = true;
        this.relevance_silent_queryPage=1;
        this.relevance_silent_queryFun(1);
        this.relevance_vendor_current='';
        this.relevancePurchaseVendorFirstTime=true;

        this.relevanceStableAnalysisIsLoading = true;
        this.relevancePriceAnalysisIsLoading = true;
        this.relevancePurchaseAnalysisIsLoading = true;
        this.relevancePurchaseAnalysisIsLoading = true;
        this.relevancePurchaseVendorIsLoading = true;
        this.relevanceVendorDetailIsLoading = true;
      },
      /*关联查询--物料搜索结果*/
      relevance_silent_queryFun: function (page) {
        var _self = this;
        _self.relevanceSilentQueryIsLoading = true;
        var yx_data = {
          "category": this.query_get_item_category_input_boss,
          "item": this.query_get_item_input_boss,
          "plan_class": this.query_get_plan_class_input_boss,
          "sourcing": this.query_get_sourcing_input_boss,
          "item_big_class": this.query_get_item_big_class_input_boss,
          "item_small_class": this.query_get_item_small_class_input_boss,
          "planner": this.query_get_planner_input_boss,
          "buyer": this.query_get_buyer_input_boss,
          "page": page
        };
        common.getData(0, common.url_constitute.relevance_silent_query, 'post', yx_data, function (d) {
          _self.relevanceSilentQueryIsLoading = false;
          if (d.data.code == 1024) {
            _self.relevance_silent_queryData = d.data.item_info;
            if(_self.relevance_silent_queryData.total<1){
              _self.relevanceSilentQueryIsError = true;
            }else{
              _self.relevanceSilentQueryIsError = false;
              if (_self.relevance_analysisFirstTime && page== 1) {
                  _self.relevance_analysisFun(_self.relevance_silent_queryData.items[0].ITEM,_self.relevance_silent_queryData.items[0].SEGMENT1);
              }
            }
          }
        })
      },
      relevance_analysisFun: function (who,name) {
        this.relevance_analysisFirstTime = false;
        this.certainItemName = name;
        this.certainItemID=who;
        this.relevance_stable_analysisFun(who);
        this.relevance_price_analysisFun(who);
        this.relevance_purchase_analysisFun(who);
        this.relevance_purchase_vendorFun(1,who);
      },

      /*关联查询--供货稳定性分析*/
      relevance_stable_analysisFun: function (who) {
        var _self = this;
        _self.relevanceStableAnalysisIsLoading = true;
        _self.relevance_stable_analysisData = {};
        var yx_data = {
          "item": who
        }
        common.getData(1, common.url_constitute.relevance_stable_analysis, 'post', yx_data, function (d) {
          _self.relevanceStableAnalysisIsLoading = false;
          if (d.data.code == 1024) {
            _self.relevance_stable_analysisData = d.data.vendor_stable_origin_info;
            if(_self.relevance_stable_analysisData.time.length<1||_self.relevance_stable_analysisData.length<1){
              _self.relevanceStableAnalysisIsError = true;
            }else{
              _self.relevanceStableAnalysisIsError = false;
              var stableBar_option = {
                tooltip: {
                  trigger: 'axis',
                  formatter: function (params) {
                    var tpl = '';
                    tpl = params[0].axisValue;
                    for (var i = 0; i < params.length; i++) {
                      tpl = tpl + '<br/>' + params[i].marker + params[i].seriesName + '：' + common.numThousand(params[i].value)
                    }
                    return tpl
                  }
                },
                legend: {
                  data: _self.relevance_stable_analysisData.VENDOR_NAME
                },
                grid: {
                  show: true,
                  top: '50',
                  left: '4%',
                  right: '4%',
                  bottom: '50',
                  borderWidth: 0
                },
                dataZoom: [{
                  show: true,
                  height: 20,
                  xAxisIndex: [0],
                  bottom: 0,
                  start: 0,
                  end: 100,
                  handleIcon: 'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
                  handleSize: '110%',
                  handleStyle: {
                    color: "#d3dee5",

                  },
                  textStyle: {
                    color: "#fff"
                  },
                  borderColor: "#90979c"
                }, {
                  type: 'inside',
                  show: true,
                  height: 15,
                  start: 1,
                  end: 35
                }],
                xAxis: {
                  type: 'category',
                  data: common.setDateMonList(_self.relevance_stable_analysisData.time),
                  name: '时间',
                },
                yAxis: [{
                  name: '供货稳定性',
                  type: 'value',
                  splitLine: {
                    lineStyle: {
                      color: '#eee'
                    }
                  },
                  axisLabel: {
                    formatter: function (v) {
                      return common.wan(v);
                    }
                  }
                }],
                series: []
              };
              for (var i = 0; i < _self.relevance_stable_analysisData.value.length; i++) {
                var seriesDataContent = {
                  name: _self.relevance_stable_analysisData.value[i].VENDOR_NAME,
                  type: 'line',
                  /*step: 'end',*/
                  itemStyle: {
                    normal: {
                      color: _self.colorList[i],
                    }
                  },
                  lineStyle: {
                    normal: {
                      color: _self.colorList[i],
                    }
                  },
                  data: _self.relevance_stable_analysisData.value[i].SCORE
                };
                stableBar_option.series.push(seriesDataContent)
              }
              var stableBar_container = echarts.init(document.getElementById('stableBar'));
              stableBar_container.setOption(stableBar_option, true);
              window.addEventListener("resize", function () {
                stableBar_container.resize();
              })
            }
          }
        })
      },
      /*关联查询--价格分析*/
      relevance_price_analysisFun: function (who) {
        var _self = this;
        _self.relevancePriceAnalysisIsLoading = true;
        var yx_data = {
          "item": who
        }
        common.getData(2, common.url_constitute.relevance_price_analysis, 'post', yx_data, function (d) {
          _self.relevancePriceAnalysisIsLoading = false;
          if (d.data.code == 1024) {
            _self.relevance_price_analysisData = d.data.item_price;
            if(_self.relevance_price_analysisData.time.length<1){
              _self.relevancePriceAnalysisIsError = true;
            }else{
              _self.relevancePriceAnalysisIsError = false;
              var priceBar_option = {
                tooltip: {
                  trigger: 'axis',
                  formatter: function (params) {
                    var tpl = '';
                    tpl = params[0].axisValue;
                    for (var i = 0; i < params.length; i++) {
                      tpl = tpl + '<br/>' + params[i].marker + params[i].seriesName + '：' + common.numThousand(params[i].value)
                    }
                    return tpl
                  }
                },
                legend: {
                  data: _self.relevance_price_analysisData.vendor_name,
                },
                grid: {
                  show: true,
                  top: '50',
                  left: '4%',
                  right: '4%',
                  bottom: '50',
                  borderWidth: 0
                },
                dataZoom: [{
                  show: true,
                  height: 20,
                  xAxisIndex: [0],
                  bottom: 0,
                  start: 0,
                  end: 100,
                  handleIcon: 'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
                  handleSize: '110%',
                  handleStyle: {
                    color: "#d3dee5",

                  },
                  textStyle: {
                    color: "#fff"
                  },
                  borderColor: "#90979c"
                }, {
                  type: 'inside',
                  show: true,
                  height: 15,
                  start: 1,
                  end: 35
                }],
                xAxis: {
                  type: 'category',
                  data: common.setDateList(_self.relevance_price_analysisData.time),
                  name: '时间',
                },
                yAxis: [{
                  name: '价格',
                  type: 'value',
                  splitLine: {
                    lineStyle: {
                      color: '#eee'
                    }
                  },
                  axisLabel: {
                    formatter: function (v) {
                      return common.wan(v);
                    }
                  }
                }],
                series: []
              };
              for (var i = 0; i < _self.relevance_price_analysisData.value.length; i++) {
                var seriesDataContent = {
                  name: _self.relevance_price_analysisData.value[i].VENDOR_NAME,
                  type: 'scatter',
                  itemStyle: {
                    normal: {
                      color: _self.colorList[i],
                    }
                  },
                  lineStyle: {
                    normal: {
                      color: _self.colorList[i],
                    }
                  },
                  data: _self.relevance_price_analysisData.value[i].PRICE,
                };
                priceBar_option.series.push(seriesDataContent)
              }
              var priceBar_container = echarts.init(document.getElementById('priceBar'));
              priceBar_container.setOption(priceBar_option,true);
              window.addEventListener("resize", function () {
                priceBar_container.resize();
              })
            }
          }
        })
      },
      /*关联查询--采购分析*/
      relevance_purchase_analysisFun: function (who) {
        var _self = this;
        _self.relevancePurchaseAnalysisIsLoading = true;
        var yx_data = {
          "item": who
        }
        common.getData(3, common.url_constitute.relevance_purchase_analysis, 'post', yx_data, function (d) {
          _self.relevancePurchaseAnalysisIsLoading = false;
          if (d.data.code == 1024) {
            _self.relevance_purchase_analysisData = d.data.item_order;
            if(_self.relevance_purchase_analysisData.time.length<1){
              _self.relevancePurchaseAnalysisIsError = true;
            }else{
              _self.relevancePurchaseAnalysisIsError = false;
              var purchaseBar_option = {
                tooltip: {
                  trigger: 'axis',
                  formatter: function (params) {
                    var tpl = '';
                    tpl = params[0].axisValue;
                    for (var i = 0; i < params.length; i++) {
                      tpl = tpl + '<br/>' + params[i].marker + params[i].seriesName + '：' + common.numThousand(params[i].value)
                    }
                    return tpl
                  }
                },
                legend: {
                  data: _self.relevance_purchase_analysisData.vendor
                },
                grid: {
                  show: true,
                  top: '50',
                  left: '4%',
                  right: '4%',
                  bottom: '50',
                  borderWidth: 0
                },
                dataZoom: [{
                  show: true,
                  height: 20,
                  xAxisIndex: [0],
                  bottom: 0,
                  start: 0,
                  end: 100,
                  handleIcon: 'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
                  handleSize: '110%',
                  handleStyle: {
                    color: "#d3dee5",

                  },
                  textStyle: {
                    color: "#fff"
                  },
                  borderColor: "#90979c"
                }, {
                  type: 'inside',
                  show: true,
                  height: 15,
                  start: 1,
                  end: 35
                }],
                xAxis: {
                  type: 'category',
                  data: _self.setDateList(_self.relevance_purchase_analysisData.time),
                  name: '时间',
                },
                yAxis: [{
                  name: '数量',
                  type: 'value',
                  splitLine: {
                    lineStyle: {
                      color: '#eee'
                    }
                  },
                  axisLabel: {
                    formatter: function (v) {
                      return common.wan(v);
                    }
                  }
                }],
                series: []
              };
              for (var i = 0; i < _self.relevance_purchase_analysisData.value.length; i++) {
                var seriesDataContent = {
                  name: _self.relevance_purchase_analysisData.value[i].VENDOR_NAME,
                  type: 'line',
                  itemStyle: {
                    normal: {
                      color: _self.colorList[i],
                    }
                  },
                  lineStyle: {
                    normal: {
                      color: _self.colorList[i],
                    }
                  },
                  data: _self.relevance_purchase_analysisData.value[i].QUANTITY
                };
                purchaseBar_option.series.push(seriesDataContent)
              }
              var purchaseBar_container = echarts.init(document.getElementById('purchaseBar'));
              purchaseBar_container.setOption(purchaseBar_option, true);
              window.addEventListener("resize", function () {
                purchaseBar_container.resize();
              })
            }
          }
        })
      },
      /*采购供应商--获取季度*/
      relevance_purchase_quarterFun: function () {
        var _self = this;
        _self.relevancePurchaseAnalysisIsLoading = true;
        var yx_data = {
          "category": this.query_get_item_category_input_boss,
          "item": this.query_get_item_input_boss,
          "plan_class": this.query_get_plan_class_input_boss,
          "sourcing": this.query_get_sourcing_input_boss,
          "item_big_class": this.query_get_item_big_class_input_boss,
          "item_small_class": this.query_get_item_small_class_input_boss,
          "planner": this.query_get_planner_input_boss,
          "buyer": this.query_get_buyer_input_boss,
        }
        common.getData(4, common.url_constitute.relevance_purchase_quarter, 'post', yx_data, function (d) {
          if (d.data.code == 1024) {
            _self.relevance_purchase_quarterData = d.data.result;
            _self.selectSeasonName_id=_self.relevance_purchase_quarterData[0].key
            _self.selectSeasonName=_self.relevance_purchase_quarterData[0].name
          }
        })
      },
      /*选择季度*/
      choose_relevance_purchase_quarterFunchoose(id, name) {
        this.relevancePurchaseVendorFirstTime=true;
        this.selectSeasonName = name;
        this.selectSeasonName_id = id;
        this.relevance_purchase_vendorFun(1)
      },
      /*采购供应商-上表*/
      relevance_purchase_vendorFun: function (page) {
        var _self = this;
        _self.relevancePurchaseVendorIsLoading = true;
        var yx_data = {
          "page": page,
          "quarter":this.selectSeasonName_id, /*this.selectSeasonName_boss,*/
          "category": this.query_get_item_category_input_boss,
          "item": this.certainItemID,
          "plan_class": this.query_get_plan_class_input_boss,
          "sourcing": this.query_get_sourcing_input_boss,
          "item_big_class": this.query_get_item_big_class_input_boss,
          "item_small_class": this.query_get_item_small_class_input_boss,
          "planner": this.query_get_planner_input_boss,
          "buyer": this.query_get_buyer_input_boss,
        }
        common.getData(5, common.url_constitute.relevance_purchase_vendor, 'post', yx_data, function (d) {
          _self.relevancePurchaseVendorIsLoading = false;
          if (d.data.code == 1024) {
            _self.relevance_purchase_vendorData = d.data.vendor_info;
            if(_self.relevance_purchase_vendorData.total<1){
              _self.relevancePurchaseVendorIsError = true;
              _self.relevanceVendorDetailIsError = true;
              _self.relevance_vendor_current = '';
              _self.relevanceVendorDetailIsLoading = false;
            }else{
              _self.relevancePurchaseVendorIsError = false;
              if(page==1&&_self.relevancePurchaseVendorFirstTime){
                _self.relevance_vendor_detailFun(_self.relevance_purchase_vendorData.items[0].VENDOR_SITE_ID, _self.relevance_purchase_vendorData.items[0].VENDOR_CODE)
              }
            }
          }else if(d.data.code==9007){
            _self.relevancePurchaseVendorIsError = true;
            _self.relevanceVendorDetailIsLoading = false;
            _self.relevanceVendorDetailIsError = true;
          }
        })
      },
      /*采购供应商-下表*/
      relevance_vendor_detailFun: function (id, name) {
        var _self = this;
        _self.relevance_vendor_current = name;
        _self.relevanceVendorDetailIsLoading = true;
        var yx_data = {
          "quarter": this.selectSeasonName_id,
          "vendor": id,
        }
        common.getData(6, common.url_constitute.relevance_vendor_detail, 'post', yx_data, function (d) {
          _self.relevanceVendorDetailIsLoading = false;
          if (d.data.code == 1024) {
            _self.relevance_vendor_detailData = d.data.vendor_detail;
            if(_self.relevance_vendor_detailData.length<1){
              _self.relevanceVendorDetailIsError = true;
            }else{
              _self.relevanceVendorDetailIsError = false;
              _self.relevance_vendor_detailData0 = _self.relevance_vendor_detailData[0];
              _self.relevance_vendor_detailData1 = _self.relevance_vendor_detailData[1];
              _self.relevance_vendor_detailData2 = _self.relevance_vendor_detailData[2];
              _self.relevance_vendor_detailData3 = _self.relevance_vendor_detailData[3];
              _self.relevance_vendor_detailData4 = _self.relevance_vendor_detailData[4];
              _self.relevance_vendor_detailData5 = _self.relevance_vendor_detailData[5];
              _self.relevance_vendor_detailData6 = _self.relevance_vendor_detailData[6];
              _self.relevance_vendor_detailData7 = _self.relevance_vendor_detailData[7];
              _self.relevance_vendor_detailData8 = _self.relevance_vendor_detailData[8];
              _self.relevance_vendor_detailData9 = _self.relevance_vendor_detailData[9];
              _self.relevance_vendor_detailData10 = _self.relevance_vendor_detailData[10];
              _self.relevance_vendor_detailData11 = _self.relevance_vendor_detailData[11];
            }
          }else if(d.data.code==9007){
            _self.relevanceVendorDetailIsError = true;
          }
        })
      }
    },
  }
</script>
<style>
  @import "../common/css/base.css";
  @import "../common/css/yx.less";
  @import "../common/css/supplier.css";
</style>
